#pragma once
#include"HashTable.h"

namespace my
{
	template<class K,class Hash = HashFunc<K>>
	class unordered_set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& data)
			{
				return data;
			}
		};

	public:
		typedef typename hash_bucket::HashTable<K, const K, SetKeyOfT, Hash>::Iterator iterator;
		typedef typename hash_bucket::HashTable<K, const K, SetKeyOfT, Hash>::ConstIterator const_iterator;

		iterator begin()
		{
			return _table.begin();
		}

		iterator end()
		{
			return _table.end();
		}
		const_iterator cbegin()
		{
			return _table.cbegin();
		}

		const_iterator cend()
		{
			return _table.cend();
		}

		bool insert(const K& data)
		{
			return _table.insert(data);
		}

		hash_bucket::HashNode<const K>*  find(const K& key)
		{
			return _table.find(key);
		}

		bool erase(const K& key)
		{
			return _table.erase(key);
		}
	private:
		hash_bucket::HashTable<K, const K,SetKeyOfT, Hash> _table;
	};
}